<?php
require_once ('../../../src/db/connectdatabase.php');
require_once ("../../dao/NewsDAO.php");

$result = false;

if(isset($_POST['act'])) {
	$action = $_POST['act'];
	if($action == 'edita') {// cho phep hien thi tren giao dien
		if(isset($_POST['type']) && isset($_POST['idpe'])) {
			$id = $_POST['idpe'];
			$isuse = $_POST['type'];
			$result = displayNews($id, $isuse);
		}
	} else if ($action == 'del') {
		if(isset($_POST['idpe'])) {
			$id = $_POST['idpe'];
			$result = deleteNews($id);
		}
	}
}

echo json_encode($result);
?>